package com.wyd.jwpkglxt_ssm.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("index")
public class PageController {

    @GetMapping("login")
    public String toLogin(){
        return "login";
    }

    @GetMapping("profile")
    public String toProfile(){
        return "public/profile";
    }

    @GetMapping("logout")
    public String toLogout(HttpServletRequest request){
        HttpSession session = request.getSession();
        session.removeAttribute("token");
        return "redirect:login";
    }

    @GetMapping("welcome")
    public String toWelcome(){
        return "public/welcome";
    }

    @GetMapping("edit_pwd")
    public String toEditPwd(){
        return "public/edit_pwd";
    }

    @GetMapping("admin/index")
    public String toAdminIndex(){
        return "admin/index";
    }

    @GetMapping("admin/user/pages_data_table")
    public String toAdminUserPagesDataTable(){
        return "admin/user/pages_data_table";
    }

    @GetMapping("admin/area/pages_data_table")
    public String toAdminAreaPagesDataTable(){
        return "admin/area/pages_data_table";
    }

    @GetMapping("admin/classroom/pages_data_table")
    public String toAdminClassroomPagesDataTable(){
        return "admin/classroom/pages_data_table";
    }

    @GetMapping("admin/department/pages_data_table")
    public String toAdminDepartmentPagesDataTable(){
        return "admin/department/pages_data_table";
    }

    @GetMapping("admin/student/pages_data_table")
    public String toAdminStudentPagesDataTable(){
        return "admin/student/pages_data_table";
    }

    @GetMapping("admin/course_system/pages_data_table")
    public String toAdminCourseSystemPagesDataTable(){
        return "admin/course_system/pages_data_table";
    }

    @GetMapping("admin/opening_class_info/pages_data_table")
    public String toAdminOpeningClassInfoPagesDataTable(){
        return "admin/opening_class_info/pages_data_table";
    }

    @GetMapping("admin/professional_title/pages_data_table")
    public String toAdminProfessionalTitlePagesDataTable(){
        return "admin/professional_title/pages_data_table";
    }

    @GetMapping("teacher/index")
    public String toTeacherIndex(){
        return "teacher/index";
    }

    @GetMapping("academic_director/index")
    public String toAcademicDirectorIndex(){
        return "academic_director/index";
    }
}
